<extend name="Base/common" />
<block name="body">
	<!--导航引用-->
	<include file="Public/nav" />
	<footer class="ui-footer ui-footer-stable ui-btn-group ui-whitespace ui-border-t">
		<input type="hidden" id="pock_money" value="{$data.pock_money}" autocomplete="off">
		<input type="hidden" id="zhekouAll" value="{$data.zhekouAll}" autocomplete="off">
		<input type="hidden" id="order_id" value="{$data.order_id}" autocomplete="off">
		<input type="hidden" id="shop_id" value="{$data.shop_id}" autocomplete="off">
		<input type="hidden" id="user_id" value="{$data.user_id}" autocomplete="off">
	    <a href="javascript:void(0);" class="ui-btn-lg ui-btn-danger paynow">立即支付</a>
	</footer>
	<section class="ui-container">
		<div class="ui-confirm-successful">
			<h1 class="ui-title ui-txt-highlight ui-border-b tc">订单已提交成功</h1>
			<div class="ui-whitespace">
				<div class="ui-confirm-successful-info">
					<p><b>订单编号：</b><a href="{:U('Order/index', array('type' => 1))}"><small class="show_order">{$data.order_id}</small></a></p>
					<p><b>支付金额：</b><span class="ui-txt-red">￥{$data.pock_money}</span></p>
					<p>
						<b>收货地址：</b><small>{$data.sname}&nbsp;&nbsp;<span>{$data.phone}</span></small><br />
						<small>{$data.pro_name} &nbsp;{$data.city_name} &nbsp;{$data.area_name} &nbsp;{$data.address}&nbsp;</small>
					</p>
				</div>
				<small class="ui-txt-info">
					如对订单有何疑问，请联系客服进行解决！<br />
					<font color='red'>客服电话：{:getCustomPhone()}</font>
				</small>
				<div class="ui-warning">
					<b>特别提醒：</b>
			        <p>因{$Think.config.RETURNTIME}天支持无理由退货，立奖金币将在交易完成后分配！</p>
				</div>
			</div>
        </div>
		<p class='test'></p>
	</section>
</block>
<block name="script">
	<script type="text/javascript">
		
		var browser={ 
		versions:function(){ 
			var u = navigator.userAgent, app = navigator.appVersion; 
			return { 
			trident: u.indexOf('Trident') > -1, //IE内核 
			presto: u.indexOf('Presto') > -1, //opera内核 
			webKit: u.indexOf('AppleWebKit') > -1, //苹果、谷歌内核 
			gecko: u.indexOf('Gecko') > -1 && u.indexOf('KHTML') == -1, //火狐内核 
			mobile: !!u.match(/AppleWebKit.*Mobile.*/)||!!u.match(/AppleWebKit/), //是否为移动终端 
			ios: !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/), //ios终端 
			android: u.indexOf('Android') > -1 || u.indexOf('Linux') > -1, //android终端或者uc浏览器 
			iPhone: u.indexOf('iPhone') > -1 || u.indexOf('Mac') > -1, //是否为iPhone或者QQHD浏览器 
			iPad: u.indexOf('iPad') > -1, //是否iPad 
			webApp: u.indexOf('Safari') == -1 //是否web应该程序，没有头部与底部 
			};
			}()
		}
		
		
		var temp_order = "";


		function _payNowFIE(amount, discount, mall_orderId, shopId, userId) {
			temp_order = mall_orderId;
			if(browser.versions.mobile&&browser.versions.ios&&browser.versions.iPhone||browser.versions.iPad){
				window.location.href = "js://" + encodeURIComponent('{"action":"pay","amount": "'+amount+'","discount":"'+discount+'","mall_orderId":"'+mall_orderId+'","shopId":"'+shopId+'","userId":"'+userId+'"}');
			}
			
			if(browser.versions.mobile&&browser.versions.android){
				window.wst.startFunction(amount, discount, mall_orderId, shopId, userId)
			}
	    }

	    $('.paynow').tap(function(){
	    	var amount = $('#pock_money').val(),
	    		discount = $('#zhekouAll').val(),
	    		mall_orderId = $('#order_id').val(),
	    		shopId = $('#shop_id').val(),
	    		userId = $('#user_id').val();

	    	temp_order = mall_orderId;
			if(browser.versions.mobile&&browser.versions.ios&&browser.versions.iPhone||browser.versions.iPad){
				window.location.href = "js://" + encodeURIComponent('{"action":"pay","amount": "'+amount+'","discount":"'+discount+'","mall_orderId":"'+mall_orderId+'","shopId":"'+shopId+'","userId":"'+userId+'"}');
			}
			
			if(browser.versions.mobile&&browser.versions.android){
				window.wst.startFunction(amount, discount, mall_orderId, shopId, userId)
			}

	    });
		
		function onPayResultCallback(statusCode){
			if(statusCode == 0){
				var url = "{:U('PayBack/index')}";
				if( url.indexOf('?')>0 ){
					url += '&order_id=' + temp_order;
				}else{
					url += '?order_id=' + temp_order;
				}
				window.location.href = url;
				return false;
			}else if(statusCode == 1){
                $.tips({content:"支付失败！",stayTime:2000,type:"success"});
			}else if(statusCode == 2){
                $.tips({content:"用户取消！",stayTime:2000,type:"success"});
			}
		}
	</script>
</block>